<template>
  <el-header>
    <img class="logo"
         src="@/assets/images/logo-small.png">
    <div class="navbar-custom-menu">
      <div class="nav-btn">
        <img src="@/assets/images/userpic.gif" />
        <el-dropdown>
          <el-button type="text">
            {{ username }}<i class="el-icon-arrow-down el-icon--right"></i>
          </el-button>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item>修改密码</el-dropdown-item>
            <el-dropdown-item>个人设置</el-dropdown-item>
            <el-dropdown-item>项目地址</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
      <div class="nav-btn">
        <el-button type="text"
                   icon="el-icon-bell">通知</el-button>
      </div>
      <div class="nav-btn">
        <el-button type="text"
                   icon="el-icon-tickets">学习教程</el-button>
      </div>

      <div class="nav-btn">
        <el-button type="text"
                   @click="logout"
                   icon="el-icon-time">退出</el-button>
      </div>
    </div>
  </el-header>
</template>
<script>
export default {

  data () {
    return {
      username: this.$store.getters.username
    }
  },
  methods: {
    logout () {
      window.sessionStorage.clear()
      this.$router.push('/login')
    }
  }
}
</script>
<style lang="less" scoped>
.el-header {
  height: 60px;
  width: 100%;
  background-color: #eef1f6;
  display: flex;
  justify-content: space-between;
  padding: 0;
  align-items: center;
  .logo {
    height: 60px;
    position: relative;
  }
  .navbar-custom-menu {
    .nav-btn {
      display: inline;
      margin-right: 15px;
      img {
        width: 45px;
        height: 45px;
        vertical-align: middle;
        background-color: white;
        border-radius: 10px;
        margin-right: 10px;
      }
    }
  }
}
</style>
